#-*-coding:utf-8-*-
import os
import socket, fcntl, struct 
import time

def get_ip2(ifname):  
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)  
    return socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s', ifname[:15]))[20:24])  

def test():
    ip =  get_ip2('wlan0') 
    a = os.popen('ilang "welcome to raspberry,my ip is"')
    time.sleep(4)
    
    print ("ok")
    
    c = os.popen('ilang "%s"'%ip)

if __name__ == "__main__":
    test()
